<template>
  <div>
    <h3>kGC新闻</h3>

    <ul class="nav">
      <li v-for="(item, index) in getAllNav" :key="index">{{ item }}</li>
      <div><li @click="tiaozhuan">+</li></div>
    </ul>
  </div>
</template>
<script>
export default {
  name: "vNav",
  mounted() {
    if (this.$store.state.allNav.length <= 0) {
      this.$axios.get("./nav.json").then((v) => {
        this.$store.commit("allNav", v.data.result);
        console.log(this.$store.state.allNav);
      });
    }
  },
  methods: {
    tiaozhuan() {
      this.$router.push({
        path: "channelManage",
      });
    },
  },
  computed: {
    getAllNav() {
      return this.$store.state.allNav;
    },
  },
};
</script>
<style scoped>
li {
  list-style-type: none;
}
h3 {
  width: 100%;
  text-align: center;
  background-color: #d43d3d;
  color: #fff;
  height: 30px;
  line-height: 30px;
}
::-webkit-scrollbar {
  display: none;
}
.nav {
  white-space: nowrap;
  display: flex;
  overflow: scroll;
  background-color: #f4f5f6;
}
.nav li {
  padding: 7px 10px;
  font-size: 16px;
  color: #505050;
}
.nav li:last-of-type {
  color: #d33d3e;
  font-size: 18px;
  line-height: 18px;
  border-left: 1px solid #ddd;
}
</style>